<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:sdu="http://sduept.com/jsf/cc">
<h:head>
	<link href="/css/primefaces/menubase.css" rel="stylesheet"
		type="text/css" />
	<title>多选设备选择器</title>
	<style type="text/css">
.value {
	font-weight: bold;
}
.ui-tree {
	width: 400px;
    position: relative;
    height: 340px;
    overflow-y: scroll;
}
</style>
</h:head>
<!-- 
使用方法
在页面中
<p:commandButton value="选择设备" icon="ui-icon-extlink" actionListener="#{flowDesignController.chooseEquipment()}">
<p:ajax event="dialogReturn"  oncomplete="PF('details').show()" listener="#{flowDesignController.onSelectorChosen}" update="details" />
</p:commandButton>
在自己的业务controller中 添加如下方法
public void chooseEquipment() {
        Map<String,Object> options = new HashMap<String, Object>();
        options.put("resizable", false);
        options.put("draggable", false);
        options.put("modal", true);
        options.put("width", 300);
        options.put("height", 400);
        RequestContext.getCurrentInstance().openDialog("/ui/common/equipment_selector_checkbox.xhtml", options, null);
    }
	public void onSelectorChosen(SelectEvent event) {
		//返回的是List<PersonnelEntityBean>
		List<PersonnelEntityBean> users = (List<PersonnelEntityBean>) event.getObject();
	}
 -->
<h:body>
	<h:form>
		<p:commandButton value="确定" icon="ui-icon-search"
			actionListener="#{equipmentSelectorController.selectCheckboxDialog}" />
		<p:tree value="#{equipmentSelectorController.root}" var="node"
			dynamic="true" id="tree" widgetVar="tree" animate="true"
			selectionMode="checkbox"
			selection="#{equipmentSelectorController.selectedNodes}">
			<p:ajax event="expand" update="tree"
				listener="#{equipmentSelectorController.onNodeExpand}" />
			<p:treeNode type="1" icon="fa fa-folder-open-o">
				<h:outputText value="#{node}" />
			</p:treeNode>
			<p:treeNode type="Substation" icon="fa fa-home">
				<h:outputText value="#{node}" />
			</p:treeNode>
			<p:treeNode type="ResourceContainer" icon="ui-icon-document">
				<h:outputText value="#{node}" />
			</p:treeNode>
			<p:treeNode type="Equipment" icon="fa fa-cc-amex">
				<h:outputText value="#{node}" />
			</p:treeNode>
		</p:tree>
	</h:form>
</h:body>
</html>
